package com.lwl.dubbo.serviceImpl;

import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import javax.annotation.Resource;

import java.util.Set;

import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.lwl.dubbo.dao.BilldetailMapper;
import com.lwl.dubbo.dao.ZcpolicyMapper;
import com.lwl.dubbo.service.BillDetailService;
import com.lwl.dubbo.service.ZcpolicyService;
import com.lwl.dubbo.bean.Zcpolicy;
import com.lwl.dubbo.util.MD5Helper;

/**
 * 农合经办点service
 * @author 
 *
 */
@Service("zcpolicyService")
public class ZcpolicyServiceImpl implements ZcpolicyService{

	/**
	 * 网点经办点Mapper
	 */

/*	@Autowired
	private ZcpolicyMapper zcpolicyMapper;
	*/
	@Resource(name="zcpolicyMapper")
	private ZcpolicyMapper zcpolicyMapper;
	
	/**
	 * 创建SqlSession的工厂
	 */
	@Autowired
	private SqlSessionFactory sqlSessionFactory;
	
	/**农合经办点
	 * @param id
	 * @return
	 */
	@Transactional
	public boolean updateZcpolicy(Zcpolicy zcpolicy) {
		return zcpolicyMapper.updateByPrimaryKeySelective(zcpolicy)> 0;
		
	}
	
	/**
	 * 逐个添加农合经办点
	 * @param Point
	 * @return
	 */
	@Transactional
	public boolean addZcpolicy(Zcpolicy zcpolicy) {
		/*return PointMapper.insert(Point) > 0;*/
		return zcpolicyMapper.insertSelective(zcpolicy) > 0;
	}
	
	/**
	 * 模糊查询
	 * @return
	 */
	public List<Zcpolicy> findByKeyword(Zcpolicy zcpolicy) {
		return zcpolicyMapper.selectByAll(zcpolicy);
	}
	
	/**
	 * 按农合经办点id查询
	 * @param userid
	 * @return
	 */
	public Zcpolicy findbyId(Integer id) {
		
		return zcpolicyMapper.selectByPrimaryKey(id);
	}

	/**
	 * 按农合经办点id删除
	 * @param userid
	 * @return
	 */
	@Transactional
	public int deleteZcpolicy(Integer id) {
		return zcpolicyMapper.deleteByPrimaryKey(id);
	}

}
